<?php

class Public_Post_CommentFormSuccessView extends BlogPublicBaseView
{
	public function executeHtml(AgaviRequestDataHolder $rd)
	{
		$this->setupHtml($rd, 'slot');
        $params = $rd->getParameters();
        $ro = $this->getContext()->getRouting();
        /* @var $user BlogUser */
        $user = $this->getContext()->getUser();
        
        $post = $this->getAttribute('post');
		
		$form_params = array(
		    'f285a77b1dbe20195abbed303ba917b9' => 0 // former 'to_comment'
		    );
		if ($user->isAuthenticated()) {
            // display_name
		    $form_params['91324832772cfd4c610d642464643020'] = $user->getAttribute('display_name');
            // email
		    $form_params['625f80171a8c3bc19df088e1b36f723d'] = $user->getAttribute('email');
		    $this->setAttribute('91324832772cfd4c610d642464643020', $user->getAttribute('display_name'));
		    $this->setAttribute('625f80171a8c3bc19df088e1b36f723d', $user->getAttribute('email'));
		    
		} else {
		    $form_params['91324832772cfd4c610d642464643020'] = $rd->getCookie('commenter_display_name');
		    $form_params['625f80171a8c3bc19df088e1b36f723d'] = $rd->getCookie('commenter_email');
		}
		
        $route_elements = array('post_id'=>$post->id);
		$sumbit_route = $ro->gen('post_by_id.comment', $route_elements);
		
		$this->getContext()->getRequest()->setAttribute('force_request_uri', 
		    $sumbit_route, 'org.agavi.filter.FormPopulationFilter');
        $this->getContext()->getRequest()->setAttribute('populate',
            new AgaviParameterHolder($form_params), 
            'org.agavi.filter.FormPopulationFilter');
		    
            
        $this->setAttribute('submit_route', $sumbit_route);
		$this->setAttribute('post_id', $post->id);
	}
}

?>
